import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    count:1,
    a:"字符串",
    token:""
  },
  getters: {
  },
  mutations: {
    setCount(state,zhi){
      console.log("远程调用了mutations里的setcount函数，参数为" + zhi)
      state.count = zhi
    },
    setToken(state,tkzhi){
      console.log("远程调用了mutations里的setcount函数，参数为" + tkzhi)

      state.token = tkzhi
    }
  },
  actions: {

    setCount(context,value){

      console.log("远程调用了actions里的setcount函数，参数为" + value)
      context.commit("setCount",value)
    },
    setToken(context,value){
      console.log("远程调用了actions里的setToken函数，参数为" + value)
      context.commit('setToken',value)
    }
  },
  modules: {
  }
})
